<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>啤酒管理</el-breadcrumb-item>
      <el-breadcrumb-item>啤酒列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 内容区域 -->
    <el-card>
      <!-- 搜索和添加 -->
      <el-row :gutter="20">
        <el-col :span="10"
          ><div class="grid-content bg-purple">
            <el-input placeholder="请输入内容" class="input-with-select">
              <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input></div
        ></el-col>
        <el-col :span="6"
          ><div class="grid-content bg-purple">
            <el-button type="success" @click="addBeer">添加啤酒</el-button>
          </div></el-col>
      </el-row>
      <!-- 添加啤酒种类 -->
      <add-beer ref="addBeerRef"></add-beer>

      <!-- 表格区域 -->
      <el-table :data="tableData" border style="width: 100%" stripe>
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column prop="beerName" label="啤酒名称"></el-table-column>
        <el-table-column prop="brand" label="品牌"> </el-table-column>
        <el-table-column prop="productionPlace" label="产地"> </el-table-column>
        <el-table-column prop="size" label="桶规格(升)"> </el-table-column>
        <el-table-column prop="wort" label="麦芽度(°)"> </el-table-column>
        <el-table-column prop="alcohol" label="酒精度(°)"> </el-table-column>
        <el-table-column label="操作" width="150">
          <template slot-scope="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import AddBeer from 'views/beer/AddBeer'

export default {
  name: 'BeerList',
  data () {
    return {
      tableData: [
        {
          id: 1,
          beerName: '白啤',
          brand: '德国HB',
          productionPlace: '山东',
          size: 20,
          wort: 13.5,
          alcohol: 4.9
        }
      ]
    }
  },
  components: {
    AddBeer
  },
  methods: {
    addBeer () {
      this.$refs.addBeerRef.dialogVisible = true
    }
  }

}
</script>

<style lang="less" scoped></style>
